package com.dwd.basic.controller;

import com.dwd.basic.service.IVerificationService;
import com.dwd.basic.utils.AjaxResult;
import com.dwd.user.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: TODO
 * @Author 汶狄
 * @Date 2021/1/17 22:02
 * @Version 1.0
 */
@RestController
@RequestMapping("/verification")
public class VerificationController {
    @Autowired
    private IVerificationService verificationService;

    @PostMapping("/sendMobileCode")
    public AjaxResult sendMobileCode(@RequestBody User user) {
        try {
            verificationService.sendMobileCode(user.getPhone());
            return AjaxResult.me();
        } catch (Exception e) {
            e.printStackTrace();
            return new AjaxResult(e.getMessage());
        }
    }
}
